﻿Public Class Form15

    Private Sub Form15_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'Test4DataSet.tbl_thu' table. You can move, or remove it, as needed.
        Me.Tbl_thuTableAdapter.Fill(Me.Test4DataSet.tbl_thu)
        Me.Tbl_testTableAdapter.Fill(Me.Test4DataSet.tbl_test)
        'Me.Tbl_test_logTableAdapter.Fill(Me.Test4DataSet.tbl_test_log)
        'Me.Tbl_test_logIUltraGrid1.setDoiTuongXuLyDuLieu(Me.Test4DataSet.tbl_test_log, Me.Tbl_test_logBindingSource1, Me.Tbl_test_logTableAdapter, Me.Test4DataSet)
        Me.Tbl_testIUltraGrid.setDoiTuongXuLyDuLieu(Me.Test4DataSet.tbl_test, Me.Tbl_testBindingSource, Me.Tbl_testTableAdapter, Me.Test4DataSet)
        Me.Tbl_testIUltraGrid.setChoPhepMenuStrip()
        Me.Tbl_test_logIUltraGrid1.setChoPhepMenuStrip()
        Me.Tbl_test_logIUltraGrid1.setChoPhepThemDong()
        Me.Tbl_test_logIUltraComBoEditor.setThemUltraGrid(Me.Tbl_test_logIUltraGrid1)
        Me.Tbl_testIUltraGrid.setGiaoDienVua()
        Me.Tbl_test_logIUltraGrid1.setUltraComboEditor(Me.Tbl_test_logIUltraComBoEditor)
        Me.Tbl_testIUltraGrid.setTimKiemTrenCotUltraGrid()
        Me.Tbl_testIUltraGrid.setThemIUltraDropDown(Me.Tbl_thuIUltraDropDown, Me.Test4DataSet.tbl_thu)

    End Sub
    Private Function GetNewRecords() As test4DataSet.tbl_testDataTable

        Return CType(Test4DataSet.tbl_test.GetChanges(Data.DataRowState.Added),  _
            test4DataSet.tbl_testDataTable)
    End Function
    Private Function GetEditRecords() As test4DataSet.tbl_testDataTable

        Return CType(Test4DataSet.tbl_test.GetChanges(Data.DataRowState.Modified),  _
            test4DataSet.tbl_testDataTable)
    End Function
    Private Function GetDeleteRecords() As test4DataSet.tbl_testDataTable

        Return CType(Test4DataSet.tbl_test.GetChanges(Data.DataRowState.Deleted),  _
            test4DataSet.tbl_testDataTable)

    End Function

    Private Sub UltraButton3_Click(sender As System.Object, e As System.EventArgs) Handles UltraButton3.Click
        Dim dt As DataTable = Me.GetNewRecords
        For index = 0 To dt.Rows.Count - 1
            Me.Tbl_test_logIUltraGrid1.getTaoMoi()
            Me.Tbl_test_logIUltraGrid1.ActiveRow.Cells("ma").Value = dt.Rows(index).Item("ma").ToString()
            Me.Tbl_test_logIUltraGrid1.ActiveRow.Cells("ten").Value = dt.Rows(index).Item("ten").ToString()
            Me.Tbl_test_logIUltraGrid1.ActiveRow.Cells("ngay").Value = dt.Rows(index).Item("ngay").ToString()
            Me.Tbl_test_logIUltraGrid1.ActiveRow.Cells("ghichu").Value = dt.Rows(index).Item("ghichu").ToString()
            'Me.Tbl_test_logIUltraGrid.Rows(0).isd()
            Me.Tbl_testIUltraGrid.setTimKiemTrenCotUltraGrid()
        Next
    End Sub

    Private Sub UltraButton4_Click(sender As System.Object, e As System.EventArgs) Handles UltraButton4.Click

        'Me.UltraPrintPreviewControl1.Refresh()
        'Me.UltraPrintPreviewControl1.Show()
    End Sub

 
End Class